<?php
include ("config.php");
include("connection/connection.php");
$frm=$_REQUEST['loc_id'];
?>

<script type="text/javascript">

function trigger_other(check_tag,action_tag){

	if($("#"+check_tag).attr("checked")){
	$("#"+action_tag).attr("disabled",false);
	}
	else{
	$("#"+action_tag).attr("disabled",true);
	$("#"+action_tag).val('');
	}
}

function float(field)
{
	
	var val = field.value;
	if(isNaN(val))
	{
		alert("Invalid entry! Only Integer and Float Values are Accepted!");
		field.focus();
		return false;
	}
}

function enable_text23(status)
{
	if(document.getElementById('type_of_disinfection')[document.getElementById('type_of_disinfection').selectedIndex].value=='Other')
	{
  		status=!status;
  		document.getElementById('type_other').disabled=status;
  		document.getElementById('type_other').focus();
	}
	else
	{
		document.getElementById('type_other').disabled=true;	
	}
}
function chkenable(val)
{
  	val=!val;
  	document.questionnaire1_3.domestic[0].disabled = val;
	document.questionnaire1_3.domestic[1].disabled = val;
}

function chkenable1(val)
{
  	val=!val;
  	document.questionnaire1_3.non_domestic[0].disabled = val;
	document.questionnaire1_3.non_domestic[1].disabled = val;
}

function chkenable2(val)
{
  val=!val;
  	document.questionnaire1_3.industrial[0].disabled = val;
	document.questionnaire1_3.industrial[1].disabled = val;
}

function trigger_defunct(status){
	if(status==1){
	$(".trigger_defunct").attr("disabled",true);
	}
	else $(".trigger_defunct").attr("disabled",false);
}

function trigger_radio(id_name,class_name){
  	//alert('sdfsdfsd');
	if($("#"+id_name).attr("checked")){
	$("."+class_name).attr("disabled",false);
	}
	else {
	$("."+class_name).attr("disabled",true);
	}
}
</script>
  <div id="scheme_section10" class="section_format">
  <script language="javascript" type="text/javascript" src="js/validate1.js"></script>
  <form action="q1_operational.php" method="post" name="questionnaire1_3" id="questionnaire1_3" onSubmit="return validate3()">
  <div id="section10" class="section_format">	
  <table border="1">
  <?php
  $qryOperational="select * from tbl_dtls_q1_last where loc_id='$_REQUEST[loc_id]'";
  $recOperational=mysql_query($qryOperational);
 
  $row_last=mysql_fetch_array($recOperational);
  ?>
    <tr>
      <td colspan="4" align="right">&nbsp;<input type="hidden" name="frmId" value="<?php echo $frm;?>" /></td>
      </tr>
    <tr>
      <td width="386">&nbsp;<b>1. Current Status of Schemes</b></td>
      <td colspan="3">&nbsp;<input type="radio" name="current_status" id="radio" value="operation"<?php echo($row_last['current_status']=='operation')?'checked':'';?> onclick="trigger_defunct(0);" />
						Operational&nbsp;
				  <input type="radio" name="current_status" id="current_status_defunct" onclick="trigger_defunct(1);" value="defunct"<?php echo($row_last['current_status']=='defunct')?'checked':'';?> />
				  Defunct&nbsp;
		</td>
      </tr>
    <tr>
      <td>&nbsp;<b>2. Actual Water Supplied (KLD)</b></td>
      <td colspan="3">&nbsp;<input type="text" name="actual_water_supply" id="actual_water_supply" size="18" onBlur="float(this)" value="<?php echo $row_last['water_supply'];?>" class="trigger_defunct" />
	  </td>
      </tr>
    <tr>
      <td>&nbsp;<b>3. Frequency of Supply</b></td>
      <td colspan="3">&nbsp;<select size="1" name="frequency_supply" id="frequency_supply" class="trigger_defunct" >
						<option selected value="0">Select Frequency</option>
						<?php 
						foreach($frequency as $key=>$val)
						{
							if($row_last['freq_supply']==$val)
							{
		   						echo "<option value=$val selected>$val</option>";
							}
							else
							{
								echo "<option value=$val>$val</option>";
							}
								
						}
						?>
						</select>
		</td>
    </tr>
    <tr>
      <td>&nbsp;<b>4. Duration of supply (hrs/ day)</b></td>
      <td colspan="3">&nbsp;<input type="text" name="duration_of_supply" id="duration_of_supply" size="18"  value="<?php echo $row_last['duration_supply'];?>" onBlur="float(this)" class="trigger_defunct" />
	  </td>
      </tr>
	  <tr>
      <td>&nbsp;<b>5. Disinfection Process</b></td>
      <td colspan="3">&nbsp;</td>
      </tr>
	  <tr>
	    <td>&nbsp;&nbsp;<b>I) Type of disinfection</b></td>
	    <td colspan="3">&nbsp;<select size="1" name="type_of_disinfection" id="type_of_disinfection"  onChange="enable_text23(true)" class="trigger_defunct">
						<option selected value="0">Select</option>
						<?php 
						/*foreach($type_disinf as $key=>$val)
						{
							if($row_last['type_disinfection']==$val)
							{
		   						echo "<option value=$val selected>$val</option>";
							}
							else
							{
								echo "<option value=$val>$val</option>";
							}
								
						}*/
						foreach($type_disinf as $key=>$val)
						{
							$val1=$row_last['type_disinfection'];
						if($val1=='Not-Provided' || $val1=='Clorine' || $val1=='Bleaching-Powder')
						{
							if($val1==$val)
							{
		   						echo "<option value=$val selected>$val</option>";
							}
							else
							{
								echo "<option value='$val'>$val</option>";
							}
						}
						if($val1!='Not-Provided' && $val1!='Clorine' && $val1!='Bleaching-Powder')
						{
							if($val1!=$val)
							{
		   						echo "<option value='Other' selected>$val</option>";
							}
							else
							{
								echo "<option value='$val'>$val</option>";
							}
						}
						}
						?>
				  </select>
				  If Other then specify</font><input type="text" name="type_other" id="type_other"  value="<?php if($row_last['type_disinfection']!='Not-Provided' && $row_last['type_disinfection']!='Clorine' && $row_last['type_disinfection']!='Bleaching-Powder'){ echo $row_last['type_disinfection'];$disb=""; } else echo '';$disb="disabled"; ?>" style="font-size: 8pt; font-family: Verdana; border-style: solid; border-width: 1px" <?php echo $disb;?>>
				 </td>
	    </tr>
	  <tr>
	    <td>&nbsp;&nbsp;<b>II) Frequency</b></td>
	    <td colspan="3">&nbsp;<select size="1" name="disinfection_frequecy" id="disinfection_frequecy" class="trigger_defunct" >
						<option selected value="0">Select</option>
						<?php 
						foreach($freq as $key=>$val)
						{
							if($row_last['freq']==$val)
							{
		   						echo "<option value=$val selected>$val</option>";
							}
							else
							{
								echo "<option value=$val>$val</option>";
							}
								
						}
						?>
				  </select>
				  </td>
	    </tr>
	  <tr>
	    <td>&nbsp;&nbsp;<b>III) Quantity of chemical Used / KL</b></td>
	    <td colspan="3">&nbsp;<input type="text" name="Quantity_of_chemical" id="Quantity_of_chemical" size="18" class="trigger_defunct" value="<?php echo $row_last['quant_chemical'];?>" onBlur="float(this)"> 
	kg
	</td>
	    </tr>
	  <tr>
	    <td>&nbsp;<b>6. Total Manpower deployed in O &amp; M</b></td>
	    <td colspan="3">&nbsp;<input type="text" name="manpower_o_m" id="manpower_o_m" size="18" class="txt5" value="<?php echo $row_last['manpwr_total'];?>"></td>
	    </tr>
	  <tr>
	    <td>&nbsp;&nbsp;&nbsp;<b>Total Technical personnel(Nos.)</b></td>
	    <td colspan="3">&nbsp;<input type="text" name="tech_emp" id="tech_emp" size="18" class="txt5" value="<?php echo $row_last['tech_emp'];?>"></td>
	    </tr>
	  <tr>
	    <td>&nbsp;<b>7. Existing means to quantify water supplied</b></td>
	    <td colspan="3"><?php
						$exist_means=explode(',',$row_last['existing_means']);
						//$a_means_exit=array('bulk_meters','pr_gauges','water_meter','measure_quantity','none');
						//$exist_means_other=array_diff($exist_means,$a_means_exit);
						//foreach($exist_means_other as $key=>$val_exist_means)
						//$means_other=substr($val_exist_means, 5);
						//$count=count($exist_report);
						//echo $exist_report[1];
						//for($i=0;$i<=$count;$i++)
						//{
						?>
					&nbsp;<input type="checkbox" name="exist_water_supplied[]" id="exist_water_supplied[]" value="bulk_meters"<?php echo  (in_array('bulk_meters',$exist_means)?'checked':'');?>> Bulk meters<br />
					&nbsp;<input type="checkbox" name="exist_water_supplied[]" id="exist_water_supplied[]" value="pr_gauges"<?php echo (in_array('pr_gauges',$exist_means)?'checked':'');?>> Pr. Gauges<br />
				  &nbsp;<input type="checkbox" name="exist_water_supplied[]" id="exist_water_supplied[]" value="water_meter"<?php echo (in_array('water_meter',$exist_means)?'checked':'');?>> Water meters at consumer end<br />
				 &nbsp;<input type="checkbox" name="exist_water_supplied[]" id="exist_water_supplied[]" value="measure_quantity"<?php echo  (in_array('measure_quantity',$exist_means)?'checked':'');?>>By measuring quantity Produced<br />
				  &nbsp;<input type="checkbox" name="exist_water_supplied[]" id="exist_water_supplied[]" value="none"<?php echo (in_array('none',$exist_means)?'checked':'');?>>None
				  </td>
	    </tr>
	  <tr>
	    <td rowspan="4" valign="top"><b>8. Water Connections</b></td>
	    <td width="190" colspan="2" style="background-color:#DADADA">&nbsp;<b>Type</b></td>
	    <td width="182" style="background-color:#DADADA">&nbsp;<b>Nos.</b></td>
	  </tr>
	  <tr>
	    <td colspan="2"><b>Domestic</b></td>
	    <td>&nbsp;<input type="text" name="water_connection_domestic" id="water_connection_domestic" size="18" class="txt5" onBlur="numeric(this)" value="<?php echo $row_last['domestic_no'];?>"></td>
	  </tr>
	  <tr>
	    <td colspan="2"><b>Non Domestic </b></td>
	    <td>&nbsp;<input type="text" name="water_connection_nondomestic" id="water_connection_nondomestic" size="18" class="txt5" onBlur="numeric(this)" value="<?php echo $row_last['nondomestic_no'];?>"></td>
	  </tr>
	  <tr>
	    <td colspan="2"><b>Industrial</b></td>
	    <td>&nbsp;<input type="text" name="water_connection_industrial" id="water_connection_industrial" size="18" class="txt5" onBlur="numeric(this)" value="<?php echo $row_last['industrial_no'];?>"></td>
	  </tr>
	  <tr>
	    <td rowspan="4" valign="top">&nbsp;<b>9. Water Billing System</b></td>
	    <td colspan="2" style="background-color:#DADADA">&nbsp;<b>Type</b></td>
	    <td style="background-color:#DADADA">&nbsp;<b>Nos.</b></td>
	  </tr>
	  <tr>
	    <td colspan="2"><b>Domestic</b></td>
	    <td>&nbsp;<input type="checkbox" name="dom" id="dom" value="ON" onClick="trigger_radio('dom','domestic_class');" <?php if($row_last['domestic_system']=='metered' || $row_last['domestic_system']=='flat rate'){ echo $cks1="checked";;$dsb1="";}else{ echo $cks1="";;$dsb1="disabled";}?>>&nbsp;<input type="radio" name="domestic" id="domestic" class="domestic_class" value="metered"<?php echo($row_last['domestic_system']=='metered')?'checked':'';?> <?php echo $dsb1;?> >Metered&nbsp;
									<input type="radio" name="domestic" id="domestic" class="domestic_class" value="flat rate"<?php echo($row_last['domestic_system']=='flat rate')?'checked':'';?> <?php echo $dsb1;?>>Flat Rate&nbsp;
		</td>
	  </tr>
	  <tr>
	    <td colspan="2"><b>Non Domestic</b></td>
	    <td>&nbsp;<input type="checkbox" name="non_dom" id="non_dom" value="ON" onClick="trigger_radio('non_dom','non_dom_class');" <?php if($row_last['nondomestic_system']=='metered' || $row_last['nondomestic_system']=='flat rate'){ echo $cks2="checked";;$dsb2="";}else{ echo $cks2="";;$dsb2="disabled";}?>>&nbsp;Non Domestic&nbsp;
		<input type="radio" name="non_domestic"id="non_domestic" class="non_dom_class" value="metered"<?php echo($row_last['nondomestic_system']=='metered')?'checked':'';?> <?php echo $dsb2;?>>Metered&nbsp;
		<input type="radio" name="non_domestic"id="non_domestic" class="non_dom_class" value="flat rate"<?php echo($row_last['nondomestic_system']=='flat rate')?'checked':'';?> <?php echo $dsb2;?>>Flat Rate&nbsp;
		</td>
	  </tr>
	  <tr>
	    <td colspan="2"><b>Industrial</b></td>
	    <td>&nbsp;<input type="checkbox" name="indus" id="indus" value="ON" onClick="trigger_radio('indus','indus_class');" <?php if($row_last['industrial_system']=='metered' || $row_last['industrial_system']=='flat rate'){ echo $cks3="checked";$dsb3="";}else{ echo $cks3="";$dsb3="disabled";}?>>&nbsp;Industrial&nbsp;
		<input type="radio" name="industrial"id="industrial" class="indus_class" value="metered"<?php echo($row_last['industrial_system']=='metered')?'checked':'';?> <?php echo $dsb3;?>>Metered&nbsp;
		<input type="radio" name="industrial"id="industrial" class="indus_class" value="flat rate"<?php echo($row_last['industrial_system']=='flat rate')?'checked':'';?> <?php echo $dsb3;?>>Flat Rate&nbsp;
		</td>
	  </tr>
	  <tr>
	    <td rowspan="2" valign="top">&nbsp;<b>10. Water Bills Raised (in <img src="images/26rup1.jpg" width="10"> Lakhs)</b></td>
	    <td style="background-color:#DADADA"><b>2009-10</b></td>
	    <td style="background-color:#DADADA"><b>2008-09</b></td>
	    <td style="background-color:#DADADA"><b>2007-08</b></td>
	  </tr>
	  <tr>
	    <td>&nbsp;<input type="text" name="wbr_09_10" id="wbr_09_10" size="18" class="txt5" onBlur="float(this)" value="<?php echo $row_last['wbs_9_10'];?>"></td>
	    <td>&nbsp;<input type="text" name="wbr_08_09" id="wbr_08_09" size="18" class="txt5" onBlur="float(this)" value="<?php echo $row_last['wbs_8_9'];?>"></td>
	    <td>&nbsp;<input type="text" name="wbr_07_08" id="wbr_07_08" size="18" class="txt5" onBlur="float(this)" value="<?php echo $row_last['wbs_7_8'];?>"></td>
	  </tr>
	  <tr>
	    <td>&nbsp;<b>11. Revenue Generated (in <img src="images/26rup1.jpg" width="10"> Lakhs)</b></td>
	    <td style="background-color:#DADADA"><b>2009-10</b></td>
	    <td style="background-color:#DADADA"><b>2008-09</b></td>
	    <td style="background-color:#DADADA"><b>2007-08</b></td>
	  </tr>
	  <tr>
	    <td>&nbsp;</td>
	    <td>&nbsp;<input type="text" name="rg_09_10" id="rg_09_10" size="18" class="txt5" onBlur="float(this)" value="<?php echo $row_last['rg_9_10'];?>"></td>
	    <td>&nbsp;<input type="text" name="rg_08_09" id="rg_08_09" size="18" class="txt5" onBlur="float(this)" value="<?php echo $row_last['rg_8_9'];?>"></td>
	    <td>&nbsp;<input type="text" name="rg_07_08" id="rg_07_08" size="18" class="txt5" onBlur="float(this)" value="<?php echo $row_last['rg_7_8'];?>"></td>
	  </tr>
	  <tr>
	    <td>&nbsp;<b>12. Annual Operations Maintenance Cost &nbsp;(in <img src="images/26rup1.jpg" width="10"> Lakhs)</b></td>
	    <td style="background-color:#DADADA"><b>FY 2009-10</b></td>
	    <td style="background-color:#DADADA">&nbsp;<b>FY 2008-09</b></td>
	    <td style="background-color:#DADADA"><b>FY 2007-08</b></td>
	  </tr>
	  <tr>
	    <td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<b>Man Power Cost</b></td>
	    <td>&nbsp;<input type="text" name="mpc_fy_09_10" id="mpc_fy_09_10" size="18" class="txt5" onBlur="float(this)" value="<?php echo $row_last['mpc_9_10'];?>"></td>
	    <td>&nbsp;<input type="text" name="mpc_fy_08_09" id="mpc_fy_08_09" size="18" class="txt5" onBlur="float(this)" value="<?php echo $row_last['mpc_8_9'];?>"></td>
	    <td>&nbsp;<input type="text" name="mpc_fy_07_08" id="mpc_fy_07_08" size="18" class="txt5" onBlur="float(this)" value="<?php echo $row_last['mpc_7_8'];?>"></td>
	  </tr>
	  <tr>
	    <td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<b>Material Cost - Machinery Repairs</b></td>
	    <td>&nbsp;<input type="text" name="mcmr_fy_09_10" id="mcmr_fy_09_10" size="18" class="txt5" onBlur="float(this)" value="<?php echo $row_last['mc_mr_9_10'];?>"></td>
	    <td>&nbsp;<input type="text" name="mcmr_fy_08_09" id="mcmr_fy_08_09" size="18" class="txt5" onBlur="float(this)" value="<?php echo $row_last['mc_mr_8_9'];?>"></td>
	    <td>&nbsp;<input type="text" name="mcmr_fy_07_08" id="mcmr_fy_07_08" size="18" class="txt5" onBlur="float(this)" value="<?php echo $row_last['mc_mr_7_8'];?>"></td>
	    </tr>
	  <tr>
	    <td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<b>Material Cost - Pipe Repairs</b></td>
	    <td>&nbsp;<input type="text" name="mcpr_fy_09_10" id="mcpr_fy_09_10" size="18" class="txt5" onBlur="float(this)" value="<?php echo $row_last['mc_pr_9_10'];?>"></td>
	    <td>&nbsp;<input type="text" name="mcpr_fy_08_09" id="mcpr_fy_08_09" size="18" class="txt5" onBlur="float(this)" value="<?php echo $row_last['mc_pr_8_9'];?>"></td>
	    <td>&nbsp;<input type="text" name="mcpr_fy_07_08" id="mcpr_fy_07_08" size="18" class="txt5" onBlur="float(this)" value="<?php echo $row_last['mc_pr_7_8'];?>"></td>
	    </tr>
	  <tr>
	    <td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<b>Power Cost</b></td>
	    <td>&nbsp;<input type="text" name="pc_fy_09_10" id="pc_fy_09_10" size="18"  class="txt5" onBlur="float(this)" value="<?php echo $row_last['pc_9_10'];?>"></td>
	    <td>&nbsp;<input type="text" name="pc_fy_08_09" id="pc_fy_08_09" size="18" class="txt5" onBlur="float(this)" value="<?php echo $row_last['pc_8_9'];?>"></td>
	    <td>&nbsp;<input type="text" name="pc_fy_07_08" id="pc_fy_07_08" size="18" class="txt5" onBlur="float(this)" value="<?php echo $row_last['pc_7_8'];?>"></td>
	    </tr>
	  <tr>
	    <td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<b>Chemicals Cost</b></td>
	    <td>&nbsp;<input type="text" name="cc_fy_09_10" id="cc_fy_09_10" size="18" class="txt5" onBlur="float(this)" value="<?php echo $row_last['cc_9_10'];?>"></td>
	    <td>&nbsp;<input type="text" name="cc_fy_08_09" id="cc_fy_08_09" size="18" class="txt5" onBlur="float(this)" value="<?php echo $row_last['cc_8_9'];?>"></td>
	    <td>&nbsp;<input type="text" name="cc_fy_07_08" id="cc_fy_07_08" size="18" class="txt5" onBlur="float(this)" value="<?php echo $row_last['cc_7_8'];?>"></td>
	    </tr>
	  <tr>
	    <td colspan="">&nbsp;<b>13. Preventive Maintenance Mechanism in Place</b></td>
	    <td colspan="3">&nbsp;<input type="radio" name="prev_main_mech_place"id="prev_main_mech_place" value="yes"<?php echo($row_last['preventive_place']=='yes')?'checked':'';?>>Yes&nbsp;
		  		  <input type="radio" name="prev_main_mech_place"id="prev_main_mech_place" value="no"<?php echo($row_last['preventive_place']=='no')?'checked':'';?>>No&nbsp;
	</td>
	  </tr>
	  <tr>
	    <td colspan="4">&nbsp;</td>
	    </tr>
	  <tr style="background-color:#DADADA">
	    <td colspan="4"><b>Complaint 
			Redressal Mechanism</b></td>
	    </tr>
	  <tr>
	    <td>&nbsp;<b>1. Existing Reporting system</b></td>
	    <td colspan="3"><?php
						$exist_report=explode(',',$row_last['existing_report']);
						$a_exit=array('By-phone','Writing','Personal-Contact','Call-Center','Other');
						$exist_other=array_diff($exist_report,$a_exit);
						foreach($exist_other as $key=>$val_exist)
						$other=substr($val_exist, 5);
						//$count=count($exist_report);
						//echo $exist_report[1];
						//for($i=0;$i<=$count;$i++)
						//{
						?>
			        <input type="checkbox" name="exist_report_sys[]" id="exist_report_sys[by-phone]" value="By-phone"<?php echo (in_array('By-phone',$exist_report)?'checked':'');?>>&nbsp;&nbsp;By-phone<br />
				      <input type="checkbox" name="exist_report_sys[]" id="exist_report_sys[writing]" value="Writing"<?php echo (in_array('Writing',$exist_report)?'checked':'');?>>&nbsp;&nbsp;Writing<br />
				      <input type="checkbox" name="exist_report_sys[]" id="exist_report_sys[personal-contact]" value="Personal-Contact"<?php echo  (in_array('Personal-Contact',$exist_report)?'checked':'');?>>&nbsp;&nbsp;Personal-Contact<br />
					   <input type="checkbox" name="exist_report_sys[]" id="exist_report_sys[call-center]" value="Call-Center"<?php echo  (in_array('Call-Center',$exist_report)?'checked':'');?>>&nbsp;&nbsp;Call Center<br />
				      <input type="checkbox" name="exist_report_sys[]" id="exist_report_sys_other" onClick="trigger_other('exist_report_sys_other','report_other');" value="Other" <?php echo ($other!='')?'checked':'';?>  />&nbsp;&nbsp;Other
		&nbsp;If Other then specify&nbsp;&nbsp;</font>
				    <input type="text" name="report_other" id="report_other" style="font-size: 8pt; font-family: Verdana; border-style: solid; border-width: 1px" value="<?php echo  $other;?>" <?php if($other=='') echo "disabled=\"disabled\""; ?> />
		</td>
	    </tr>
	  <tr>
	    <td>&nbsp;<b>2. Time Taken to address the complaint</b></td>
	    <td colspan="3">&nbsp;<select size="1" name="time_taken" id="time_taken" class="txt" >
						<option selected value="0">Select Day</option>
						<?php 
						foreach($time as $key=>$val)
						{
							if($row_last['time_taken']==$val)
							{
		   						echo "<option value=$val selected>$val</option>";
							}
							else
							{
								echo "<option value=$val>$val</option>";
							}
								
						}
						?>
				  		</select>
			</td>
	    </tr>
	  <tr>
	    <td colspan="4">&nbsp;<b>3. Types of Complaint received (avg. per month)</b></td>
	    </tr>
	  <tr>
	    <td>&nbsp;<b>Non Supply of water due to power failure</b></td>
	    <td colspan="3">&nbsp;<input type="checkbox" name="nonsupply_water" id="nonsupply_water" value="ON"<?php echo($row_last['complaint_1'] != '')?'checked':'';?> onClick="enable_text22(this.checked)"><?php if($row2[complaint_1]!=""){echo "%";} ?>&nbsp;<input type="text" name="complaint_1" id="complaint_1" size="10" value="<?php echo $row_last['complaint_1'];?>" style="font-size: 8pt; font-family: Verdana; border-style: solid; border-width: 1px" onBlur="numeric(this)">%<br />
		</td>
	    </tr>
	  <tr>
	    <td>&nbsp;<b>Poor Water Quality</b></td>
	    <td colspan="3">&nbsp;<input type="checkbox" name="poor_water_quality" id="poor_water_quality" value="ON"<?php echo($row_last['complaint_2'] != '')?'checked':'';?> onClick="enable_text12(this.checked)">&nbsp;<input type="text" name="complaint_2" id="complaint_2" size="10" value="<?php echo $row_last['complaint_2'];?>" style="font-size: 8pt; font-family: Verdana; border-style: solid; border-width: 1px" onBlur="numeric(this)"><?php if($row2[complaint_2]!=""){echo "%";} ?></td>
	    </tr>
	  <tr>
	    <td><b>Absence of PHED field Staff</b></td>
	    <td colspan="3">&nbsp;<input type="checkbox" name="absence_phed" id="absence_phed" value="ON"<?php echo($row_last['complaint_3'] != '')?'checked':'';?> onClick="enable_text13(this.checked)">&nbsp;<input type="text" name="complaint_3" id="complaint_3" size="10" value="<?php echo $row_last['complaint_3'];?>" style="font-size: 8pt; font-family: Verdana; border-style: solid; border-width: 1px" onBlur="numeric(this)"><?php if($row2[complaint_3]!=""){echo "%";} ?></td>
	    </tr>
	  <tr>
	    <td>&nbsp;<b>Polluted sources of drinking water</b></td>
	    <td colspan="3">&nbsp;<input type="checkbox" name="polluted_src_water" id="polluted_src_water" value="ON"<?php echo($row_last['complaint_4'] != '')?'checked':'';?> onClick="enable_text14(this.checked)">&nbsp;<input type="text" name="complaint_4" id="complaint_4" size="10" value="<?php echo $row_last['complaint_4'];?>" style="font-size: 8pt; font-family: Verdana; border-style: solid; border-width: 1px" onBlur="numeric(this)"><?php if($row2[complaint_4]!=""){echo "%";} ?></td>
	    </tr>
	  <tr>
	    <td>&nbsp;<b>Distribution of Water supply due to poorly 
							maintained Water Supply Infrastructure</b></td>
	    <td colspan="3">&nbsp;<input type="checkbox" name="distri_water_supply" id="distri_water_supply" value="ON"<?php echo($row_last['complaint_5'] != '')?'checked':'';?> onClick="enable_text15(this.checked)">&nbsp;<input type="text" name="complaint_5" id="complaint_5" size="10" value="<?php echo $row_last['complaint_5'];?>" style="font-size: 8pt; font-family: Verdana; border-style: solid; border-width: 1px" onBlur="numeric(this)"><?php if($row2[complaint_5]!=""){echo "%";} ?></td>
	    </tr>
	  <tr>
	    <td>&nbsp;</td>
	    <td colspan="3">&nbsp;</td>
	    </tr>
	  <tr style="background-color:#DADADA">
	    <td colspan="4">&nbsp;<b>Constraint / Issues Faced by PHED officials</b></td>
	    </tr>
	  <tr>
	    <td><b>Institutional</b></td>
	    <td colspan="3"><?php 
					$exist_inst=explode(',',$row_last['institutional']);
					?>
					<input type="checkbox" name="institutional[]" id="institutional[]" value="Procedural Delays"<?php echo  (in_array('Procedural Delays',$exist_inst)?'checked':'');?>>Procedural Delays<br />
				<input type="checkbox" name="institutional[]" id="institutional[]" value="Needs Streamlining of procedures"<?php echo  (in_array('Needs Streamlining of procedures',$exist_inst)?'checked':'');?>>Needs Streamlining of procedures&nbsp; <br />
				<?php
				  $a_inst=array('Procedural Delays','Needs Streamlining of procedures');
						$exist_instutional=array_diff($exist_inst,$a_inst);
						foreach($exist_instutional as $key=>$val_inst)
						//echo $val;
						//$other=substr($val, 5);
						?>
					
					<input type="checkbox" name="institutional[]" id="institutional_other_check" value=""<?php echo ($val_inst!='')?'checked':'';?> onClick="trigger_other('institutional_other_check','institutional_other');" />Others (Specify)&nbsp; </font>
				  <input type="text" name="institutional_other" id="institutional_other" size="31" style="font-size: 8pt; font-family: Verdana; border-style: solid; border-width: 1px" value="<?php echo $val_inst;?>" <?php if($val_inst=='') echo "disabled =\"disabled\" ";  ?> />
				</td>
	    </tr>
	  <tr>
	    <td><b>Financial</b></td>
	    <td colspan="3"><?php 
					$exist_fin=explode(',',$row_last['financial']);
					$a_fin=array('Financial constraints at operational level');
						$exist_financial=array_diff($exist_fin,$a_fin);
						foreach($exist_financial as $key=>$val_fin)
					?>
					<input type="checkbox" name="financial[]" id="financial[]" value="Financial constraints at operational level"<?php echo  (in_array('Financial constraints at operational level',$exist_fin)?'checked':'');?>>Financial constraints at operational level
					<br />
					<input type="checkbox" name="financial[]" id="financial_other_check" onClick="trigger_other('financial_other_check','financial_other');" value="" <?php echo  ($val_fin!='')?'checked':'';?> />Others Specify)&nbsp;<br />
					<input type="text" name="financial_other" id="financial_other" size="31" style="font-size: 8pt; font-family: Verdana; border-style: solid; border-width: 1px" value="<?php echo $val_fin;?>" <?php if($val_fin=='') echo "disabled= \"disabled\" " ; ?> />
					</td>
	    </tr>
	  <tr>
	    <td><b>Operational</b></td>
	    <td colspan="3"><?php 
					$exist_opt=explode(',',$row_last['operational']);
					$a_opt=array('Manpower Shortage','Lack Vehicles for movement','Shortages of Spares');
						$exist_operational=array_diff($exist_opt,$a_opt);
						foreach($exist_operational as $key=>$val_opt)
					?>
					<input type="checkbox" name="operational[]" id="operational[]" value="Manpower Shortage"<?php echo  (in_array('Manpower Shortage',$exist_opt)?'checked':'');?>>Manpower Shortage
					<br />
					<input type="checkbox" name="operational[]" id="operational[]" value="Lack Vehicles for movement"<?php echo  (in_array('Lack Vehicles for movement',$exist_opt)?'checked':'');?>>Lack Vehicles for movement<br />
					<input type="checkbox" name="operational[]" id="operational[]" value="Shortages of Spares"<?php echo  (in_array('Shortages of Spares',$exist_opt)?'checked':'');?>>Shortages of Spares<br />
					<input type="checkbox" name="operational[]" id="operational_other_check" onClick="trigger_other('operational_other_check','operational_other');" value=""<?php echo  ($val_opt!='')?'checked':'';?> />Others (Specify)&nbsp; </font>
	<input type="text" name="operational_other" id="operational_other" size="31" style="font-size: 8pt; font-family: Verdana; border-style: solid; border-width: 1px" value="<?php echo $val_opt;  ?>" <?php if($val_opt=='') echo "disabled =\"disabled\" ";?> />
					</td>
	    </tr>
		<tr><td colspan="6" align="center"><input type="submit" value="EDIT" name="submit" style="font-size: 8pt; font-family: Verdana; border-style: solid; border-width: 1px; font-weight:bold; background:#666666; color:#FFFFFF; width:140px; height:30px" onClick="view_validate()">
		</td></tr>
  </table>
  </div>
  </form>
  </div>
